/**
 * 
 */

package cn.cn77.futures.widget;

import cn.cn77.futures.R;
import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * @author sun
 */
public class NavigationBar extends LinearLayout {
	private TextView naviTitleTv;
	private LinearLayout backLL;

	public NavigationBar(Context context) {
		super(context);
	}

	public NavigationBar(final Context context, AttributeSet attrs) {
		super(context, attrs);
		LayoutInflater.from(context).inflate(R.layout.navigation_bar, this);
		naviTitleTv = (TextView) findViewById(R.id.tv_bar_title);
		backLL = (LinearLayout) findViewById(R.id.ll_bar_back);
		backLL.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				((Activity) context).finish();
			}
		});
	}

	/**
	 * 设置导航栏标题
	 * 
	 * @param barTitle
	 */
	public void setTitle(String barTitle) {
		naviTitleTv.setText(barTitle);
	}

}
